import store from '../store'

// localStorage
export function setLocalStorage(key, value) {
  localStorage[key] = JSON.stringify(value)
}
export function getLocalStorage(key) {
  if (typeof localStorage[key] === 'string') {
    return localStorage[key]
  } else {
    return localStorage[key] ? JSON.parse(localStorage[key]) : ''
  }
}
// 获取url参数
export function getQueryString(name) {
  let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
  let r = window.location.search.substr(1).match(reg)
  if (r != null) {
    return unescape(r[2])
  }
  return null
}
